﻿#include "WRWorkObjectStatusChangeEvent.h"

static int g_workObjectStatusChangeEventType = QEvent::registerEventType();

//判断指定的事件是否是当前事件。
bool WRWorkObjectStatusChangeEvent::identify(const QEvent* e)
{
    return (e) && (e->type() == g_workObjectStatusChangeEventType);
}
//判断指定的事件是否是当前事件。
bool WRWorkObjectStatusChangeEvent::identify(const QEvent& e)
{
    return e.type() == g_workObjectStatusChangeEventType;
}

//初始化工作对象状态改变事件。
WRWorkObjectStatusChangeEvent::WRWorkObjectStatusChangeEvent(WRWorkObject* target, WRWorkStatus status)
    : QEvent((QEvent::Type)g_workObjectStatusChangeEventType)
{
    m_index = -1;
    m_target = target;
    m_status = status;
    m_target->addRef();
}
//初始化工作对象状态改变事件。
WRWorkObjectStatusChangeEvent::WRWorkObjectStatusChangeEvent(int index, WRWorkObject* target, WRWorkStatus status)
    : QEvent((QEvent::Type)g_workObjectStatusChangeEventType)
{
    m_index = index;
    m_target = target;
    m_status = status;
    m_target->addRef();
}
//释放当前对象所占用的相关资源。
WRWorkObjectStatusChangeEvent::~WRWorkObjectStatusChangeEvent(void)
{
    m_target->release();
}


